package com.chem.lems.repository;

import com.chem.lems.entity.Record;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

public interface RecordRepository extends JpaRepository<Record,String>, JpaSpecificationExecutor<Record> {

    // 设备归还确认查询
    @Query(value = "SELECT * FROM lems_record WHERE back_time IS NULL AND user_id=?1 AND equip_id=?2",nativeQuery = true)
    Record findrecord(String userId, String equipId);

    // 查询用户绑定的借用记录
    @Query(value = "SELECT * FROM lems_record WHERE user_id=?1",nativeQuery = true)
    List<Record> findAllByUserId(String userId);
}
